package com.mycompany.app.model;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

public class Person implements Cloneable {

	private Long id;
	
	private String firstName;
	
	private String lastName;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof Person)) {
			return false;
		}
		Person rhs = (Person) object;
		EqualsBuilder equalsBuilder = new EqualsBuilder();
		equalsBuilder = equalsBuilder.append(this.firstName, rhs.firstName);
		equalsBuilder = equalsBuilder.append(this.lastName, rhs.lastName);
		return equalsBuilder.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(-2103428611, -1146536185);
		hashCodeBuilder = hashCodeBuilder.append(this.firstName);
		hashCodeBuilder = hashCodeBuilder.append(this.lastName);
		return hashCodeBuilder.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		ToStringBuilder toStringBuilder = new ToStringBuilder(this);
		toStringBuilder = toStringBuilder.append("id", this.id);
		toStringBuilder = toStringBuilder.append("firstName", this.firstName);
		toStringBuilder = toStringBuilder.append("lastName", this.lastName);
		return toStringBuilder.toString();
	}

	@Override
	public Person clone() throws CloneNotSupportedException {
		Person person = new Person();
		person.setFirstName(firstName);
		person.setLastName(lastName);
		return person;
	}

	
}